package com.mak001.lite.multiSkill.GUI.Tabs;

import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Rectangle;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class FireMakerTab extends JPanel{
	private static final long serialVersionUID = 1L;

	private JTextField textField11;
	private JComboBox fmLogDropDown;
	
	String[] logs = { "normal", "achey", "oak", "wilow", "teak", "maple",
			"mahogany", "arctic pine", "eucalyptus", "yew", "magic" };
	
	public FireMakerTab(){
		textField11 = new JTextField();
		fmLogDropDown = new JComboBox();
		this.setLayout(null);

		// ---- textField11 ----
		textField11.setText("Logs to Burn");
		textField11.setEditable(false);
		textField11.setHorizontalAlignment(SwingConstants.CENTER);
		this.add(textField11);
		textField11.setBounds(115, 25, 130, textField11
				.getPreferredSize().height);

		// ---- fmLogDropDown ----
		fmLogDropDown.setModel(new DefaultComboBoxModel(logs));
		this.add(fmLogDropDown);
		fmLogDropDown.setBounds(115, 50, 130, fmLogDropDown
				.getPreferredSize().height);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for (int i = 0; i < this.getComponentCount(); i++) {
				Rectangle bounds = this.getComponent(i)
						.getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width,
						preferredSize.width);
				preferredSize.height = Math.max(bounds.y
						+ bounds.height, preferredSize.height);
			}
			Insets insets = this.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			this.setMinimumSize(preferredSize);
			this.setPreferredSize(preferredSize);
		}
	}

	public String getLogName() {
		return fmLogDropDown.getSelectedItem().toString();
	}

	public int getLogs() {
		String s = fmLogDropDown.getSelectedItem().toString();
		if (s.contains("normal")) {
			return 1511;
		} else if (s.contains("achey")) {
			return 2862;
		} else if (s.contains("oak")) {
			return 1521;
		} else if (s.contains("wilow")) {
			return 1519;
		} else if (s.contains("teak")) {
			return 6333;
		} else if (s.contains("maple")) {
			return 1517;
		} else if (s.contains("mahogany")) {
			return 6332;
		} else if (s.contains("arctic pine")) {
			return 10810;
		} else if (s.contains("eucalyptus")) {
			return 12581;
		} else if (s.contains("yew")) {
			return 1515;
		} else {// magic
			return 1513;
		}
	}

}
